#ifndef IDT_H
#define IDT_H

#include "../../tools/headers/common.h"


/* The following abbreviations will be used
 * throughout this file:
 * IDT - The Interrupt Descriptor Table 
 * IDTR - The Interrupt Descriptor Table Register */
 
/* A structure of the IDT entry. */
typedef struct idt_entry
{
    u16int base_low;
    u16int selector;
    u8int zero; //This must be zero.
    u8int flags;
    u16int base_high;
} __attribute__((packed)) idt_entry_type;

/* A structure of the pointer to the IDT */
typedef struct
{
    u16int limit;
    u32int base;
} __attribute__((packed)) idt_pointer_type;

typedef void (*isr_type)(registers_type);



/* Initializes the IDT. */
void init_idt();

/* Inserts an entry to the IDT */
void idt_set_gate(u8int number, u32int base, u16int selector, u8int flags);

void register_interrupt_handler(u8int interrupt_number, isr_type handler);

#endif
